import logging
import os

WORK_DIR = os.path.dirname(__file__)

PROJ_NAME = "text_classifier"


def init_log():
    logger = logging.getLogger(PROJ_NAME)
    logger.setLevel(logging.INFO)

    fh = logging.FileHandler("%s/%s.log" % (WORK_DIR, PROJ_NAME), mode="w")
    fh.setLevel(logging.INFO)

    formatter = logging.Formatter(
        "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    )
    fh.setFormatter(formatter)

    logger.addHandler(fh)
    return logger


LOGGER = init_log()
